Skip to content

AppBuilder - Rewrite system prompt, add preview awareness and clickable preview links#302

Draft
eshurakov wants to merge 1 commit intomainfrom
eshurakov/app-builder-system-prompt
Draft

AppBuilder - Rewrite system prompt, add preview awareness and clickable preview links#302
eshurakov wants to merge 1 commit intomainfrom
eshurakov/app-builder-system-prompt

Conversation

@eshurakov
Copy link
Contributor

Summary

  • Rewrites the App Builder system prompt to use non-technical, user-friendly language with a vocabulary guide, preview awareness instructions, and good/bad response examples
  • Sends the current preview path (the page the user is viewing) with each message so the LLM can prioritize changes visible on that page
  • Makes relative links in assistant messages (e.g. [take a look](/about)) clickable to navigate the preview iframe via postMessage

Details

System prompt (constants.ts): Replaces the old prompt with sections for how to talk to the user, a vocabulary guide (avoid technical terms by default), preview awareness (link to relevant pages after changes), project conventions, and concrete good/bad examples.

Preview path plumbing: streaming.ts reads the current iframe URL from the store and extracts the pathname. This is passed as previewPath through the tRPC schema → service layer, where it's prepended to the user's message as [The user is currently viewing: /path]. Schema validates it must start with /, contain no whitespace, and be ≤2048 chars.

Clickable preview links (MessageContent.tsx, AppBuilderChat.tsx, AppBuilderPreview.tsx, ProjectManager.ts): Relative links in markdown are intercepted and routed through manager.navigatePreview(path), which calls a handler registered by AppBuilderPreview that posts a navigation message to the iframe. Uses a direct callback pattern — no state stored; if the iframe isn't ready, the click is a no-op and the user can click again.

…ble preview links

- Rewrite system prompt to use non-technical language with vocabulary guide,
  preview awareness section, and good/bad examples
- Send current preview path with each message so the LLM knows which page
  the user is viewing (prepended as context to the prompt)
- Make relative links in assistant messages clickable to navigate the preview
  iframe via postMessage, using a callback pattern on ProjectManager
- Validate previewPath schema: must start with /, no whitespace, max 2048 chars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments